﻿#ifndef ENLARGEUI_H
#define ENLARGEUI_H

#include <QWidget>
#include <QMutex>
#include <QCloseEvent>
#include <QResizeEvent>
#include <QMoveEvent>
#include <QPaintEvent>


#pragma execution_character_set("utf-8")

#include "tool.h"

namespace Ui {
class enlargeUI;
}

class enlargeUI : public QWidget
{
    Q_OBJECT

public:
    explicit enlargeUI(QWidget *parent = nullptr);
    ~enlargeUI();

    QMutex *screenImageMutex;
    cv::Mat curEnlargeImage;
    bool isFlush;
    void setZoom(float zoom);
    void setWin(int x,int y,int w,int h,int winWidth=0,int winHeight=0);

signals:
    void sendExit(void);
    void sendZoom(float zoom);
    void sendMove(int x,int y);
    void sendSize(int w,int h);

private slots:
    void flushImage(void);
    void recvImageCursorPos(int x,int y);
    void recvImageDoubleClicked(void);

    void on_doubleSpinBoxZoom_valueChanged(double arg1);

private:
    Ui::enlargeUI *ui;

    bool isLock;
    int curX,curY;
    int winWidth,winHeight;
    float imageZoom;

protected:
    void moveEvent(QMoveEvent *event) override;
    void resizeEvent(QResizeEvent *event) override;
    void paintEvent(QPaintEvent *event) override;
    void closeEvent(QCloseEvent *event) override;

};

#endif // ENLARGEUI_H
